<?php

use think\facade\Route;
use app\admin\middleware\LoginMiddleware;
use app\admin\middleware\AuthMiddleware;
use app\admin\middleware\OperationLog;

Route::group('crud', function () {

    Route::group('table', function () {
        // 获取所有的数据列表
        Route::get('getAllTableList', 'crud.Table/getAllTableList');
        // 获取模型数据列表
        Route::get('getModelList', 'crud.Table/getModelList');
        // 获取字典类型数据列表
        Route::get('getCrudDictDataList', 'crud.Table/getCrudDictDataList');
        // 获取字典类型列表
        Route::get('getCrudTypeList', 'crud.Table/getCrudTypeList');
    });

    Route::group('code', function () {
        // 代码生成列表
        Route::get('lists', 'crud.Code/lists');
        // 导入数据表
        Route::post('import', 'crud.Code/import');
        // 预览代码
        Route::post('preview', 'crud.Code/preview');
        // 同步表结构
        Route::post('sync', 'crud.Code/sync');
        // 生成代码
        Route::post('generate', 'crud.Code/generate');
        // 编辑代码生成字段
        Route::post('edit', 'crud.Code/edit');
        // 代码生成字段详情
        Route::get('detail', 'crud.Code/detail');
        // 删除代码生成字段
        Route::delete('delete', 'crud.Code/delete');
    });

})->middleware([
    LoginMiddleware::class,
    AuthMiddleware::class,
    OperationLog::class
]);